//
// Created by lfm on 25-4-7.
//

#include "Location.h"

Location::Location(double x_val, double y_val) : x(x_val), y(y_val) {}

double Location::Getx()
{
    return x;
}
double Location::Gety()
{
    return y;
}

double Location::distance(Location other)
{
    double dx = x - other.x;
    double dy = y - other.y;
    return sqrt(dx * dx + dy * dy);
}

double distance(Location &a, Location &b)
{
    double dx = a.x - b.x;
    double dy = a.y - b.y;
    return sqrt(dx * dx + dy * dy);
}